主题
强制解绑 - ForceUnBind
函数简介
在新设备上凭 激活码 解绑旧设备上的绑定关系(换机场景)。与 解绑 - UnBind 不同:
- 不要求 当前设备已有有效授权;
- 必须 传入待解绑的激活码;
- 软件发布者须在后台软件管理页面中开启「开放客户端解绑」(
ClientUnbindEnabled),并配置换绑规则。
典型流程:ForceUnBind(激活码) → Activate(同一激活码) → Login。
返回数据格式与 UnBind 相同:
json
{
"Code": 1,
"ServerTime": "2026-04-24 10:00:00.000",
"Message": "",
"LicenceKeys": ["xxxx-xxxx-xxxx"]
}| 字段名 | 说明 |
|---|---|
| Code | 1=成功,0=失败 |
| Time | 服务器时间戳(毫秒) |
| Message | 提示信息;失败时多为 错误码:中文描述(如 "2003:参数无效")。完整对照见 客户端错误码说明。 |
| LicenseKey | 被解绑的激活码 |
常见错误码(Message 字段)
格式:{错误码}:{中文描述}。
| Message | 含义 |
|---|---|
2003:参数无效 | 参数无效(如激活码为空) |
2004:用户不存在 | 用户不存在 |
2005:软件不可用或未开通 | 软件不可用或未开通 |
2013:未开放客户端解绑 | 须在后台开启 ClientUnbindEnabled |
2099:… | 解绑业务失败(冒号后可能为具体原因) |
2099:未知错误 | 未知错误 |
完整对照见 客户端错误码说明。
接口名称
ForceUnBindDLL 调用
long ForceUnBind(string userCode, string softCode, string softVersion, string dealerCode, string licenseKey);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| userCode | 字符串 | 用户码 |
| softCode | 字符串 | 软件码 |
| softVersion | 字符串 | 软件版本 |
| dealerCode | 字符串 | 经销商码 |
| licenseKey | 字符串 | 必填,待解绑的激活码 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
OlaAuthUnbindReturn result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// result.Code == 1 表示解绑成功csharp
using OLAPlug;
var ola = new OLAPlugServer();
OlaAuthUnbindReturn result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// result.Code == 1 表示解绑成功python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
json_result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")
# Python SDK 返回 JSON 字符串,需自行解析java
import com.olaplug.OLAPlugServer;
import com.olaplug.model.OlaAuthUnbindReturn;
OLAPlugServer ola = new OLAPlugServer();
OlaAuthUnbindReturn result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// result.Code == 1 表示解绑成功go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
result := ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")
// result.Code == 1 表示解绑成功rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let result = ola.force_un_bind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// result.code == 1 表示解绑成功cpp
var ola = com("OlaPlug.OlaSoft")
var result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
Set result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")text
.局部变量 ola, OLAPlug
.局部变量 result, OlaAuthUnbindReturn
ola.创建 ()
result = ola.ForceUnBind(“userCode”, “softCode”, “1.0.0”, “dealerCode”, “DK-XXXX-XXXX”)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var json = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// Aardio SDK 返回 JSON 字符串,需自行解析text
变量 ola <类型 = OLAPlugServer>
变量 result <类型 = OlaAuthUnbindReturn>
ola = 新建 OLAPlugServer
result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
OlaAuthUnbindReturn result = ola.ForceUnBind("userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");
// result.Code == 1 表示解绑成功原生 DLL 调用
cpp
ForceUnBind(instance, "userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long ForceUnBind(string userCode, string softCode, string softVersion, string dealerCode, string licenseKey);
ForceUnBind(instance, "userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.ForceUnBind(instance, "userCode", "softCode", "1.0.0", "dealerCode", "DK-XXXX-XXXX")服务端 HTTP 路径
插件内部请求:
POST /api/services/app/ola/forceUnbind返回值
| 返回值 | 说明 |
|---|---|
| 非 0 | 成功,返回 JSON 字符串格式的结果 |
| 0 | 失败 |
与 UnBind 的对比
| 项目 | UnBind | ForceUnBind |
|---|---|---|
| 当前设备授权 | 必须有 | 不需要 |
| licenseKey | 可选(空=解绑本机全部) | 必填 |
| 软件开关 | 无 | 须开启客户端解绑 |
| 换机场景 | 不适用 | 推荐 |
注意事项
| 项目 | 说明 |
|---|---|
| 释放内存 | 返回的字符串指针需调用 FreeStringPtr |
| 二次激活 | 解绑成功后须在新设备调用 Activate,再 Login |
| 发布者配置 | 须在欧拉后台为软件开启「开放客户端解绑」并配置换绑规则 |
| 一码多设备 | 若激活码同时绑定多个设备,接口会失败,需联系客服 |
| 错误码 | Code == 0 且 Message 以 2013: 开头表示未开放客户端解绑;完整码表见 客户端错误码说明 |
